import { ChannelCredentials, ProtobufMessage } from 'grpc'

export interface WxProtoMessage extends ProtobufMessage {
  HelloService: new (address: string, credentials: ChannelCredentials) => RPCClient
}

export interface GRPCBaseResponse<D = any> {
  code: number
  message: string
  data: D
}

type GRPCResponse<T> = (error: any, response: T) => void

type SayHelloReponse = GRPCResponse<GRPCBaseResponse<{ name: string, age: number }>>

export interface RPCClient {
  SayHello: (args: { message: string }, response: SayHelloReponse) => void
}
